﻿@using XStudio.XCRF.Data.Entities.CureInfo
@using XStudio.XCRF.Web.Models.CureInfo
@model IEnumerable<Disease>
@{
string id = Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldId("");
string name = Html.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName("");
int i = 0;
foreach (Disease disease in DiseaseInfo.Diseases)
{
    bool isChecked = Model.Any(d=>d.ID == disease.ID);
    if(isChecked)
    {
        <input type="checkbox" id="@(id)_@i" onchange="DiseaseCheckChanged('@id', @i);" checked="checked" />
    }
    else
    {
        <input type="checkbox" id="@(id)_@i" onchange="DiseaseCheckChanged('@id', @i);" />
    }
    <input type="hidden" name="@(name).Index" id="@(id)_index_@i" value="@i" @{if(!isChecked){@Html.Raw("disabled='disabled'")}} />
    <input type="hidden" name="@(name)[@i].ID" id="@(id)_@(i)_ID" value="@disease.ID" @{if(!isChecked){@Html.Raw("disabled='disabled'")}}/>
    <input type="hidden" name="@(name)[@i].Name" id="@(id)_@(i)_Name" value="@disease.Name" @{if(!isChecked){@Html.Raw("disabled='disabled'")}}/>
    @disease.Name
    i++;
}
}